#ifndef OBJMESH_LOADER_HPP
#define OBJMESH_LOADER_HPP

#include "IMeshLoader.hpp"
#include "MeshStructure.hpp"
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#include <string>

namespace Model {

class ObjMeshLoader : IMeshLoader {
public:
  using MeshRefs = std::vector<MeshRef>;

  virtual void Load();

  ObjMeshLoader(const std::string &fileName);
  ~ObjMeshLoader();

  MeshRefs &GetMeshes();

private:
  ObjMeshLoader(const ObjMeshLoader &) = delete;
  ObjMeshLoader &operator=(const ObjMeshLoader &) = delete;
  void ProcessNode(aiNode *node, const aiScene *scene);
  void ProcessMesh(aiMesh *mesh, const aiScene *scene);

private:
  std::string _fileName;
  MeshRefs _meshes;
};

} // namespace Model

#endif